Install Odoo 16 on Ubuntu 20.04

  • Step 1:

    Step 1: Update Package Manager

    
                  sudo apt-get update  
    
    sudo apt-get upgrade -y
    

    Step 2: Create an Odoo User

    
    sudo adduser -system -home=/opt/odoo -group odoo
    

    Step 3: Install PostgreSQL and Create an Odoo User for PostgreSQL

    
    
    sudo apt install postgresql -y
    
    sudo su – postgres -c "createuser -s odoo" 2> /dev/null || true
    
    sudo chmod 700 -R /var/lib/postgresql/14/main/
    
    sudo systemctl restart postgresql
    
    

    Step 4: Installation of Python and Python PIP Dependencies

    
    sudo apt-get install git python3 python3-pip build-essential wget python3-dev python3-venv python3-wheel libxslt-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less libjpeg-dev gdebi -y
    
    sudo apt-get install libpq-dev python3-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libffi-dev python3-psutil python3-polib python3-dateutil python3-decorator python3-lxml python3-reportlab python3-pil python3-passlib python3-werkzeug python3-psycopg2 python3-pypdf2 python3-gevent -y
    
    

    Step 5: Additional Packages Required

    
    sudo apt-get install nodejs npm -y
    
    sudo npm install -g rtlcss
    
    

    Step 6: Installation of wkhtmltox

    
    sudo apt-get install xfonts-75dpi xfonts-base -y
    
    wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
    
    sudo dpkg -i wkhtmltox_0.12.6.1-2.jammy_amd64.deb
    
    

    Step 7: Create a Log Directory and Provide Permissions

    
    sudo mkdir /var/log/odoo
    
    sudo chown odoo:odoo /var/log/odoo
    

    Step 8: Installation of Odoo 16

    
    sudo apt-get install git
    
    sudo git clone https://www.github.com/odoo/odoo /opt/odoo/odoo-server -b 16.0 --depth 1
    

    Step 9: Setup Required Permissions

    
    sudo chown -R odoo:odoo /opt/odoo/
    

    Step 10: Creation of a Server Configuration File

    
    sudo touch /etc/odoo-server.conf
    
    sudo su root -c "printf '[options] \n; This is the password that allows database operations:\n' | sudo tee /etc/odoo-server.conf"
    
    sudo su root -c "printf 'admin_passwd = admin\n' | sudo tee /etc/odoo-server.conf"
    
    sudo su root -c "printf 'xmlrpc_port = 9080\n' | sudo tee /etc/odoo-server.conf"
    
    sudo su root -c "printf 'logfile = /var/log/odoo/odoo-server.log\n' | sudo tee /etc/odoo-server.conf"
    
    sudo su root -c "printf 'addons_path=/opt/odoo/odoo-server/addons\n' | sudo tee /etc/odoo-server.conf"
    
    

    vim /etc/odoo-server.conf

    
    [DEFAULT]
    addons_path = /opt/odoo/odoo-server/addons
    

    Give the configuration file the appropriate permissions:

    
    sudo chown odoo:odoo /etc/odoo-server.conf
    
    sudo chmod 640 /etc/odoo-server.conf
    

    we must switch to the Odoo user by executing the command below:

    
    sudo su -l odoo -s /bin/bash
    
    cd odoo-server 
    
    python3 -m venv odoo-venv  
    
    source odoo-venv/bin/activate 
    
    
    pip3 install wheel 
    
    pip3 install -r requirements.txt
    
    

    Using the deactivate command will allow us to leave the virtual environment after installing Python dependencies:

    
    deactivate
    

    Step 11: Start the Odoo Instance

    
    cd /opt/odoo/odoo-server
    
    source odoo-venv/bin/activate
    
    ./odoo-bin -c /etc/odoo-server.conf
    

    Step 12: Login and Access the Odoo Application

    
    http://localhost:8069